package com.example.demo.mapper;

import com.example.demo.bean.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @author jie
 * @date 2019/7/14 -20:31
 */
@Mapper
public interface UserMapper {
    @Select("SELECT * FROM USER WHERE name LIKE #{keywords}")
    List<User> getAllUser(@Param("keywords") String keywords);

    @Insert("INSERT INTO `test`.`user` ( `name`, `address`, `date`) " +
            "VALUES  ( #{name}, #{address}, #{date}) ;")
    int addUser(User user);

    @Delete("delete from user where id = #{id}")
    int delUser(String id);

    @Update("update user set name=#{name},address=#{address},date=#{date} where id=#{id}")
    int updateUser(User user);

}
